<div class="layuimini-main">

    <form class="layui-form layuimini-form" lay-filter="editDockForm">
        <div class="layui-form-item" hidden>
            <label class="layui-form-label required">编号</label>
            <div class="layui-input-block">
                <input type="text" name="id" lay-verify="required" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">所在区域</label>
            <div class="layui-input-block">
                <input type="text" name="region" placeholder="请输入所在区域" value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">X坐标值</label>
            <div class="layui-input-block">
                <input type="text" name="xPosition" placeholder="请输入所在区域" value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">Y坐标值</label>
            <div class="layui-input-block">
                <input type="text" name="yPosition" placeholder="请输入所在区域" value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
            </div>
        </div>
    </form>
</div>
<script>
    layui.use(['form', 'table'], function () {
        var form = layui.form,
            layer = layui.layer,
            table = layui.table,
            $ = layui.$;
        $(function () {
            $('title').html('park点信息') //
        })

        // 初始化表单
        form.render();

        // 当前弹出层，防止ID被覆盖
        var parentIndex = layer.index;





        //监听提交
        form.on('submit(saveBtn)', function (data) {

            $.ajax({
                url: 'api/Dock/Update/' + data.field.id,
                method: 'put',
                contentType: 'application/json',
                cache: false,
                data: JSON.stringify(data.field),
                success: function (res) {
                    if (res.code === 200) {
                        var index = layer.msg('修改成功!', { icon: 1 }, function () {
                            {
                                layer.closeAll();
                            }
                        });
                    }
                    else
                        layer.msg('添加失败!', { icon: 2 });
                },
                error: function (data) {
                    layer.msg('添加出错!', { icon: 2 });

                }
            });

            return false;
        });


    });</script>